﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace Skynet.WPF4.Views.NewControls
{
    public class GenderTemplateSelector : DataTemplateSelector
    {
        public DataTemplate MaleTemplate { get; set; }
        public DataTemplate FemaleTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            dynamic customer = item;
            if (customer == null)
                return base.SelectTemplate(item, container);

            if (customer.gender == "male")
            {
                return MaleTemplate;
            }
            return FemaleTemplate;
        }
    }
}
